home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / noclick / noclick.s
Text File  |  1980-01-03  |  2KB  |  63 lines

  1. AbsExecBase=$4
  2. _LVOCreateIORequest=-$28E
  3. _LVODeleteIORequest=-$294
  4. _LVODeleteMsgPort=-$2A0
  5. _LVOCreateMsgPort=-$29A
  6. _LVOOpenDevice=-$1BC
  7. _LVOCloseDevice=-$1C2
  8. TDP_NOCLICK=$35
  9.  
  10. *******************************************************************************
  11. * NoClick
  12. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  13. *    This small snippet of assembly source-code allows you to turns off/on
  14. * the disk-drive clicking. Note: This one only works on OS2.0 and above!
  15. *
  16. * The first time its run the drive clicking is stopped. The second time it
  17. * is re-enabled.
  18. *******************************************************************************
  19.  
  20. _AllPatch    moveq    #0,d0            ;df0 
  21.         bsr.s    _PatchDrives
  22.         moveq    #1,d0            ;df1
  23.         bsr.s    _PatchDrives
  24.         moveq    #2,d0            ;df2
  25.         bsr.s    _PatchDrives
  26.         moveq    #3,d0            ;df3
  27.  
  28. _PatchDrives:    move.l    d0,d7            ;save drive to patch for later
  29.  
  30.         move.l    (AbsExecBase).w,a6    ;get execbase
  31.         jsr    _LVOCreateMsgPort(a6)    ;Generate a message port
  32.         move.l    d0,a5            ;save msg port ptr
  33.         beq.s    PortFail        ;exit if failed!
  34.  
  35.         move.l    a5,a0            ;ptr to our msg port
  36.         moveq    #48,d0
  37.         jsr    _LVOCreateIORequest(a6)    ;Do an IO request
  38.         move.l    d0,a3            ;save request ptr
  39.         beq.s    IOFail            ;exit if failed!
  40.  
  41.         lea    TDName.txt(pc),a0    ;ptr to 'trackdisk' name
  42.         move.l    d7,d0            ;drive.. dfx
  43.         move.l    a3,a1            ;IO Request
  44.         moveq    #0,d1
  45.         jsr    _LVOOpenDevice(a6)    ;Open the trackdisk device
  46.         tst.b    d0            ;did it fail?
  47.         bne.s    TDFail            ;if >0 failed to open!
  48.  
  49.         move.l    $18(a3),a0        ;get ptr to public flags
  50.         bchg    d0,TDP_NOCLICK(a0)    ;fix critical bit (BIT 0!)
  51.                         ;use BCLR 2 turn click back on!
  52. CloseTD:    move.l    a3,a1
  53.         jsr    _LVOCloseDevice(a6)    ;close trackdisk device
  54. TDFail:        move.l    a3,a0
  55.         jsr    _LVODeleteIORequest(a6)    ;kill the IO request
  56. IOFail:        move.l    a5,a0
  57.         jsr    _LVODeleteMsgPort(a6)    ;delete the message port
  58. PortFail:    moveq    #0,d0            ;no cli error code
  59.         rts
  60.  
  61. TDName.txt:    dc.b    'trackdisk.device',0
  62.         even
  63.